package com.an.java.javaall.oj;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String allDataStr = scanner.nextLine();
        String[] results = allDataStr.split(";");
        double[][] xiNumArrs = new double[3][5];
        // 系数
        for (int i = 0; i < 3; i++) {
            String xiNumStr = results[i];
            int tmpIndex = 0;
            for (String it : xiNumStr.split(",")) {
                xiNumArrs[i][tmpIndex++] = Double.parseDouble(it);
            }
        }
        // 变量
        double[] xxNum = new double[5];
        int tmpIndex = 0;
        for (String it : results[3].split(",")) {
            xxNum[tmpIndex++] = Double.parseDouble(it);
        }
        // 值
        double[] valueNum = new double[3];
        tmpIndex = 0;
        for (String it : results[4].split(",")) {
            valueNum[tmpIndex++] = Double.parseDouble(it);
        }
        // 符号
        String[] sysBoal = new String[3];
        tmpIndex = 0;
        for (String it : results[5].split(",")) {
            sysBoal[tmpIndex++] = it;
        }

        List<Double> leftValues = new ArrayList<>();
        boolean targetResult = true;
        for (int i = 0; i < 3; i++) {
            double leftResult = 0;
            for (int j = 0; j < 5; j++) {
                leftResult += xiNumArrs[i][j] * xxNum[j];
            }
            leftValues.add(leftResult - valueNum[i]);
            targetResult = targetResult && compare(sysBoal[i], leftResult, valueNum[i]);
        }
        leftValues.sort(Double::compareTo);
        String max = leftValues.get(2).toString().split("\\.")[0];
        System.out.printf(targetResult + " " + max);
    }

    public static boolean compare(String symboal, double left, double right) {
        if ("<=".equals(symboal)) {
            return Double.compare(left, right) <= 0;
        }
        if (">=".equals(symboal)) {
            return Double.compare(left, right) >= 0;
        }
        if ("<".equals(symboal)) {
            return Double.compare(left, right) < 0;
        }
        if (">".equals(symboal)) {
            return Double.compare(left, right) > 0;
        }
        return Double.compare(left, right) == 0;
    }
}
